import { service } from '@/utils/axios'

const BASE_URL = '/v1/task-distribution'

// 新增
export function addTaskData(data: any): Promise<any> {
  return service({
    url: BASE_URL,
    method: 'post',
    data
  })
}

// 更新
export function updateTaskData(code: any, data: any): Promise<any> {
  return service({
    url: `${BASE_URL}/${code}`,
    method: 'put',
    data
  })
}

export function getTaskPageList(params: any) {
  return service({
    url: `${BASE_URL}/page`,
    method: 'get',
    params
  })
}

export function getTaskDataForm(code: any): Promise<any> {
  return service({
    url: `${BASE_URL}/${code}/form`,
    method: 'get'
  })
}

export function updateDataStatus(code: any, status: any): Promise<any> {
  return service({
    url: `${BASE_URL}/${code}/status`,
    method: 'put',
    params: {
      status: status
    }
  })
}
